/*
 * Copyright (c) ycq_work@163.com
 */

package com.mxg.blog.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.mxg.blog.entity.Project;
import com.mxg.blog.entity.Skill;
import com.mxg.blog.mapper.ProjectMapper;
import com.mxg.blog.service.ProjectService;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Author: ycq_work@163.com
 * @DATE: 2023/7/24 13:19
 * 接口实现的具体方法
 */
@Service
public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> implements ProjectService {
    private final ProjectMapper projectMapper;

    public ProjectServiceImpl(ProjectMapper projectMapper) {
        this.projectMapper = projectMapper;
    }


    // 根据id查询
    @Override
    public Project getProjectById(Integer id)
    {
        return projectMapper.getProjectById(id);
    }

    // 前台获取所有可显示的项目卡片
    @Override
    public List<Project> getProjects(Integer userId){
        return projectMapper.getProjects(userId);
    }

    // 后台管理,获取所有项目

    @Override
    public List<Project> getAllProject(Integer userId)
    {
        return projectMapper.getAllProject(userId);
    }

    // 添加技能
    @Override
    public void addProject(String projectContent, Integer userId)
    {
        projectMapper.addProject(projectContent, userId);
    }

    // 删除技能
    @Override
    public void deleteProject(Integer id)
    {
        projectMapper.deleteProject(id);
    }

    // 更新技能
    @Override
    public void updateProject(String projectContent, Integer id)
    {
        projectMapper.updateProject(projectContent, id);
    }

    // 修改项目显示状态
    @Override
    public void changeProjectStatus(Integer projectStatus, Integer id)
    {
        projectMapper.changeProjectStatus(projectStatus, id);
    }
}
